<template>
  <div class="qr-popover">
      <div class="click" v-if="isShow1" :style="{width}">
         <span class="title">{{title}}</span>
         <div class="content">{{content}}</div>
      </div>
      <div class="click1" v-if="isShow2" :style="{width}">
         <span class="title">{{title}}</span>
         <div class="content">{{content}}</div>
      </div>
      <div class="click2" v-if="isShow3" :style="{width}">
         <span class="title">{{title}}</span>
         <div class="content">{{content}}</div>
      </div>
      <div>
         <qr-button @mouseover="isShow1 = true" @mouseout="isShow1 = false" class="qr-button">hover 触发</qr-button>
         <qr-button @click="isShow2 = !isShow2" @mouseout="isShow2 = false">click 触发</qr-button>
         <qr-button @click="isShow3 = !isShow3">手动触发</qr-button>
      </div>
  </div>
</template>

<script>
export default {
 name: 'QrPopover',
 data() {
   return {
     isShow1: false,
     isShow2: false,
     isShow3: false
   }
 },
 props: {
   title: {
     type: String,
     default: ''
   },
   content: {
     type: String,
     default: ''
   },
   width: {
     type: String,
     default: '200px'
   }
 }
}
</script>

<style lang="scss"  scoped>
   .click {
      width: 200px;
      background-color: #fff;
      border: 1px solid #ebeef5;
      box-shadow: 3px 3px 12px 0px rgba(0,0,0,.2);
      border-radius: 5px;;
      position: absolute;
      padding: 10px 10px;
      top: 50px;
      left: 0px;
      .title {
         font-size: 16px;
         
      }
      .content {
         font-size: 14px;
         margin-top: 5px;
      }
   }
   .click1 {
      width: 200px;
      background-color: #fff;
      border: 1px solid #ebeef5;
      box-shadow: 3px 3px 12px 0px rgba(0,0,0,.2);
      border-radius: 5px;;
      position: absolute;
      padding: 10px 10px;
      top: 50px;
      left: 70px;
      .title {
         font-size: 16px;
         
      }
      .content {
         font-size: 14px;
         margin-top: 5px;
      }
   }
   .click2 {
      width: 200px;
      background-color: #fff;
      border: 1px solid #ebeef5;
      box-shadow: 3px 3px 12px 0px rgba(0,0,0,.2);
      border-radius: 5px;;
      position: absolute;
      padding: 10px 10px;
      top: -90px;
      left: 200px;
      .title {
         font-size: 16px;
         
      }
      .content {
         font-size: 14px;
         margin-top: 5px;
      }
   }
   .qr-popover {
     position: relative;
   }
   .qr-button {
    margin-right: 20px;
   }
</style>
